namespace Cofe.Data.Migrations
{
    using System;
    using System.Data.Entity.Migrations;
    
    public partial class CofeMedia : DbMigration
    {
        public override void Up()
        {
            CreateTable(
                "dbo.MediaInfo",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Type = c.String(nullable: false, maxLength: 50),
                        Width = c.Int(nullable: false),
                        Height = c.Int(nullable: false),
                    })
                .PrimaryKey(t => new { t.Id, t.Type })
                .ForeignKey("dbo.CofeItemInfo", t => new { t.Id, t.Type }, cascadeDelete: true)
                .Index(t => new { t.Id, t.Type });
            
            CreateTable(
                "dbo.ImageInfo",
                c => new
                    {
                        Id = c.Guid(nullable: false),
                        Type = c.String(nullable: false, maxLength: 50),
                        CameraModel = c.String(maxLength: 100),
                        CameraMaker = c.String(maxLength: 100),
                        Orientation = c.Short(nullable: false),
                        Aperture = c.Single(nullable: false),
                        FNumber = c.Int(nullable: false),
                        ExposureTime = c.Int(nullable: false),
                        ISO = c.Short(nullable: false),
                        FocalLength = c.Int(nullable: false),
                        Flash = c.Short(nullable: false),
                        DateTime = c.DateTime(nullable: false),
                        Discriminator = c.String(nullable: false, maxLength: 128),
                    })
                .PrimaryKey(t => new { t.Id, t.Type })
                .ForeignKey("dbo.MediaInfo", t => new { t.Id, t.Type }, cascadeDelete: true)
                .Index(t => new { t.Id, t.Type });
            
        }
        
        public override void Down()
        {
            DropIndex("dbo.ImageInfo", new[] { "Id", "Type" });
            DropIndex("dbo.MediaInfo", new[] { "Id", "Type" });
            DropForeignKey("dbo.ImageInfo", new[] { "Id", "Type" }, "dbo.MediaInfo");
            DropForeignKey("dbo.MediaInfo", new[] { "Id", "Type" }, "dbo.CofeItemInfo");
            DropTable("dbo.ImageInfo");
            DropTable("dbo.MediaInfo");
        }
    }
}
